/**
 * @file:          LESO.h
 * @brief:
 * @details:
 * @author:        wjh
 * @date created:  2023.08.06
 * @version:       1.0.0
 * @par copyright (c):
 *
 * @par history (desc):
 *   version:1.0.0, wjh, 2023.08.06,01:34:05
 */

#ifndef _LESO_H_
#define _LESO_H_

/* Include Files **************************************************************/
#include "Datatype.h"
#include "TrackingDifferentiator.h"
#include "FalLinear.h"

/* Macro Definition ***********************************************************/

/* Data Type Define ***********************************************************/
typedef struct LESO
{
    /* public data */
    uint16 param_en;
    uint16 param_single_turn_mode;
    float param_h;
    float param_b0k;
    float param_b0;
    float param_z3k;
    float param_wp;
    float param_ws;
    float param_wd;
    float param_k0;
    TrackingDifferentiator td;
    FalLinear fe;
    FalLinear fe1;

    float err;
    float beta1;
    float beta2;
    float beta3;
    float z1_last;
    float z2_last;
    float z3_last;

    float in_u;
    float in_y;
    float out_z1;
    float out_z2;
    float out_z3;

    /* private data */

    /* public method */
    void (*Init)(struct LESO *self);
    void (*Run)(struct LESO *self);
    void (*Init_z1z2z3)(struct LESO *self, float init_z1, float init_z2, float init_z3);
    void (*UpdateParam)(struct LESO *self);

    /* private method */

} LESO;

/* Variable Declare ***********************************************************/

/* Function Declare ***********************************************************/
void LESO_Init(struct LESO *self);
void LESO_Run(struct LESO *self);
void LESO_Run_td_filt(struct LESO *self);
void LESO_Init_z1z2z3(struct LESO *self, float init_z1, float init_z2, float init_z3);
void LESO_UpdateParam(struct LESO *self);

#endif